﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using ThoiTrang.Entities;
using ThoiTrang.Business;

public partial class ecard_det : System.Web.UI.Page
{
    protected int MsgId = 0;
    protected int AccessCode = 0;
    protected a_eCard_Msg ecardMsg = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        GetInputs();
        LoadData();
        UpdateView();
    }

    protected void GetInputs()
    {
        string str = Request["msgid"];
        if (str != string.Empty && Convert.ToInt32(str) > 0)
            MsgId = Convert.ToInt32(str);
        str = Request["ac"];
        if (str != string.Empty && Convert.ToInt32(str) > 0)
            AccessCode = Convert.ToInt32(str);
    }

    protected void LoadData()
    {

        try
        {
            ecardMsg = a_eCard_MsgService.Geta_eCard_Msg(MsgId, AccessCode);
        }
        catch (Exception ex)
        {
        }
    }

    protected void UpdateView()
    {
        if (ecardMsg == null) return;
        lbDate.InnerHtml = ecardMsg.DateCreated.ToShortDateString();
        from.Value = ecardMsg.FromName;
        to.Value = ecardMsg.ToName;
        imgThoiTrang.ImageUrl = string.Concat("hinh-anh-nguoi-mau/", ecardMsg.ImageName);
        lnkOrtherImages.HRef = ecardMsg.ArticleBackLink;
        tuade.InnerHtml = ecardMsg.MsgHeading;
        noidung.InnerHtml = ecardMsg.MsgText;
        if (ecardMsg.Layout == 3)
        {
            col1.Attributes.Clear();
            col1.Attributes.Add("class", "des fr");

            col2.Attributes.Clear();
            col2.Attributes.Add("class", "pic fl");

        }

    }
}

